{*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2012 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

<!-- MODULE Home Featured Products -->
<script type="text/javascript">
$(document).ready(function(){
	$('.items').mouseenter(function(){
		var myItem = this;
		$(myItem).find('img').eq(0).fadeOut('fast',function(){
			$(myItem).find('img').eq(1).fadeIn('fast');
		})
	}).mouseleave(function(){
		var myItem = this;
		$(myItem).find('img').eq(1).hide();
		$(myItem).find('img').eq(0).show();
	})
	
	
})
function changeImg(my,img, url, urlOriginal)
{
	alert('hello'+ img);
	$('#productImg'+img).fadeOut('fast',function(){
		$('#productImg'+img).attr("src",url);
		$('#productImg'+img).fadeIn('fast');
	});
}
</script>
<div id="show">
    <h3 style="margin-left: 10px; padding: 0px; font-size: 1.2em;">Our Products</h3>
    <p id="al"><a href="#">All Product <img src="img/muiten.png"></a></p>
            {assign var='liHeight' value=250}
            {assign var='nbItemsPerLine' value=4}
            {assign var='i' value=1}
            {assign var='nbLi' value=$products|@count}
    <!--hung.nguyentuan 16/4/2013 change price immediately -->
            <script>var totalProduct = {$products|@count};</script>
            {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
            {math equation="nbLines*liHeight" nbLines=$nbLines|ceil liHeight=$liHeight assign=ulHeight}
            {foreach from=$products item=product name=homeFeaturedProducts}
                {math equation="(total%perLine)" total=$smarty.foreach.homeFeaturedProducts.total perLine=$nbItemsPerLine assign=totModulo}
            {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
    <div class="items" style="cursor: pointer" onclick="window.location.href = '{$product.link}'">
    <!--hung.nguyentuan 17/4/2013 change image-->
        <img id="productImg1" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" height="{$homeSize.height}">
		<img style="display:none" id="productImg2" src="{if $product.id_image_2 != null}{$link->getImageLink($product.link_rewrite, $product.id_image_2, 'home_default')}{else}{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}{/if}" height="{$homeSize.height}">
        <h3><a href="{$product.link}" title="{$product.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3>
        <p >From: <span id="product{$i++}">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>
        <!--<a class="exclusive ajax_add_to_cart_button add-cart" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart')}?qty=1&amp;id_product={$product.id_product}&amp;token={$static_token}&amp;add" title="{l s='Cart' mod='homefeatured'}"  href="#"><img src="img/cart_bt.png">Cart</a>-->
    </div><!--End #Items-->
{/foreach}
</div>
